//
//  ViewController.m
//  Test
//
//  Created by longchao on 5/27/15.
//  Copyright (c) 2015 longchao. All rights reserved.
//

#import "ViewController.h"

#import <AVOSCloud/AVOSCloud.h>

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //金馆长_小学生
    
    //金馆长_漫画
    
    //金馆长_熊猫人
    
    //金馆长_动态
    
    //大集合
    
    
//    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
//    NSString *documentsDirectory = [paths objectAtIndex:0];
//
//    NSFileManager *fileManager = [NSFileManager defaultManager];
//     NSError *error = nil;
//    NSArray *files = [fileManager contentsOfDirectoryAtPath:documentsDirectory error:&error];
//    //NSLog(@"文件地址列表：%@",files);
//    
//    //NSData *data = [NSData dataWithContentsOfFile:testPath];
//    NSMutableArray *array = [NSMutableArray array];
//    for (int i=1; i<files.count; i++) {
//
//        UIImage *image = [UIImage imageWithContentsOfFile:[documentsDirectory stringByAppendingPathComponent:[files objectAtIndex:i]]];
//        AVObject *gameScore1 = [AVObject objectWithClassName:@"dajihe"];
//        //[gameScore setObject:[NSNumber numberWithInt:1337] forKey:@"score"];
//        [gameScore1 setObject:UIImageJPEGRepresentation(image,1) forKey:@"image"];
//        [array addObject:gameScore1];
//
//    }
//    [AVObject saveAllInBackground:array block:^(BOOL succeeded, NSError *error) {
//        if (succeeded) {
//            NSLog(@"保存完毕了");
//        }
//    }];
//    return;
    
    
//    NSString *path = [[NSBundle mainBundle] pathForResource:@"0e206211673911545a4d4aca4c247607" ofType:nil];
//    UIImage *image = [UIImage imageWithContentsOfFile:path];
//
//    AVObject *gameScore1 = [AVObject objectWithClassName:@"ImageData"];
//    //[gameScore setObject:[NSNumber numberWithInt:1337] forKey:@"score"];
//    [gameScore1 setObject:UIImageJPEGRepresentation(image,1) forKey:@"image"];
//    [gameScore1 setObject:[NSNumber numberWithBool:NO] forKey:@"cheatMode"];
//    
//    path = [[NSBundle mainBundle] pathForResource:@"0f8a76abe1560f009db67d6fe1ec6cdb" ofType:nil];
//    image = [UIImage imageWithContentsOfFile:path];
//    
//    AVObject *gameScore2 = [AVObject objectWithClassName:@"ImageData"];
//    //[gameScore setObject:[NSNumber numberWithInt:1337] forKey:@"score"];
//    [gameScore2 setObject:UIImageJPEGRepresentation(image,1) forKey:@"image"];
//    [gameScore2 setObject:[NSNumber numberWithBool:NO] forKey:@"cheatMode"];
//    
//    [AVObject saveAllInBackground:@[gameScore1,gameScore2]];
    
    
    //给数据库添加推荐app列表
    
    //孕妈妈https://itunes.apple.com/cn/app/yun-ma-ma-bao-dian/id822431295?l=en&mt=8
    
//        NSString *path = [[NSBundle mainBundle] pathForResource:@"fuck" ofType:@"jpg"];
//        UIImage *image = [UIImage imageWithContentsOfFile:path];
//    
//        AVObject *gameScore1 = [AVObject objectWithClassName:@"recommendedApps"];
//        [gameScore1 setObject:UIImageJPEGRepresentation(image,1) forKey:@"image"];
//        [gameScore1 setObject:@"孕妈妈" forKey:@"appname"];
//        [gameScore1 setObject:@"https://itunes.apple.com/cn/app/yun-ma-ma-bao-dian/id822431295?l=en&mt=8" forKey:@"applink"];
//    [gameScore1 saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
//        if (succeeded) {
//            NSLog(@"sd");
//        }
//    }];
    //提交版本信息
    AVObject *version = [AVObject objectWithClassName:@"appVersion"];
    [version setObject:@"LT.EmojiApp" forKey:@"bundleid"];
    [version setObject:@"1.1" forKey:@"version"];
    [version saveInBackground];
//    AVQuery *query = [AVQuery queryWithClassName:@"ImageData"];
//    AVObject *obj = [query getObjectWithId:@"5566c323e4b069eef9bfb3ff"];
//    UIImage *image = [[UIImage alloc] initWithData:[obj objectForKey:@"image"]];
//    NSLog(@"%@",image);
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
